package cn.jupiter.servlet;

import java.sql.Connection;

import javax.servlet.http.HttpServletRequest;

import cn.jupiter.db.DbUtils;
import cn.jupiter.db.Map2DataBase;
import cn.jupiter.json.RestResource;

/**
 * @author pizhenhua@gmail.com
 *
 */
public class DeleteTypeWorker extends TypeWorker implements ITypeWork{
	public DeleteTypeWorker(HttpServletRequest request){
		super(request);
	}

	public void execute() {
		String url =super.getRequest().getRequestURL().toString();
		//��������url����
		RestResource r=RestUrlParser.parserUrl(url);
		if(super.getRequest().getParameter("id")!=null){
			r.setId(super.getRequest().getParameter("id"));
		}
		Map2DataBase m=new Map2DataBase();
		Connection conn;
		try {
			conn = DbUtils.getConn();
			m.deleteJson(conn, r);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
